package com.itheima.day20.demo06;

import sun.security.krb5.internal.crypto.Des;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.nio.charset.StandardCharsets;

public class demo11 {
    public static final String SRC = "./homework/src/com/itheima/day20/demo06/1.txt";
    public static final String DEST = "./homework/src/com/itheima/day20/demo06/copy7.txt";

    public static void main(String[] args) throws Exception {
        FileReader fr = new FileReader(SRC);
        BufferedReader br = new BufferedReader(fr);
        FileWriter fw = new FileWriter(DEST);
        int c = 0;
        while ((c = fr.read()) != -1) {
            //c现在是gbk
            char char1 = (char) c;
            System.out.println(char1);
            String s = String.valueOf(char1);
            byte[] bytes = s.getBytes(StandardCharsets.UTF_8);
            String s2 = new String(bytes);

            fw.write(s2);
        }

        fw.close();
        fr.close();

    }
}
